
#include <iostream>
#include <string>
using namespace std;

class Clone {
public:
    virtual Clone* clone() = 0;
    virtual void show() = 0;
};

class Sheep : public Clone {
public:
    Sheep(int id, string name) : m_id(id), m_name(name){
        cout << "Sheep(id, name)" << endl;
        cout << "id address:" << &m_id << endl;
        cout << "name address:" << &m_name << endl;
    }

    Sheep(Sheep& obj) {
        this->m_id = obj.m_id;
        this->m_name = obj.m_name;
        cout << "Sheep(obj)" << endl;
        cout << "id address:" << &m_id << endl;
        cout << "name address:" << &m_name << endl;
    }

    ~Sheep() {}

    Clone* clone() override {
        return new Sheep(*this);
    }

    void show() override {
        cout << "id:" << m_id << endl;
        cout << "name:" << m_name << endl;
    }

private:
    int m_id;
    std::string m_name;
};

int main(int argc, char *argv[]) {
    Clone *sheep = new Sheep(1, "sheep 1");
    sheep->show();

    Clone *sheep2 = sheep->clone();
    sheep2->show();

    return 0;
}